package io.jpress.module.article.flowable.delegate;

import com.jfinal.aop.Inject;
import io.jpress.commons.flowable.FlowConsts;
import io.jpress.module.article.service.ArticleService;
import io.jpress.core.flowable.AutoLoadServiceTaskDelegate;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;

@AutoLoadServiceTaskDelegate(title = "永久删除文章",type = "article",order = 100)
public class DeleteArticleDelegate implements JavaDelegate {

    @Inject
    private ArticleService articleService;

    @Override
    public void execute(DelegateExecution execution) {
        Object articleId = execution.getVariable(FlowConsts.VAR_CONTENT_ID);
        articleService.deleteById(articleId);
    }
}
